﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace ToolRental.Services
{
    [ServiceContract]
    public interface IAdminService
    {
        /* Tool Types administration */
        [OperationContract]
        List<ToolType> GetToolTypes();

        [OperationContract]
        void AddToolType(ToolType toolType);

        /* Tools administration */
        [OperationContract]
        List<Tool> GetTools(int toolTypeId);

        [OperationContract]
        void AddTool(string stockNumber, int toolTypeId);

        /* Borrow administration */
        [OperationContract]
        void NewBorrow(int idOrder, int idTool, DateTime deadline);

        [OperationContract]
        List<Order> GetOrders();

        [OperationContract]
        List<Borrow> GetBorrows();

        /* Customer Order */
        [OperationContract]
        void NewOrder(int idToolType, int idUser);

        [OperationContract]
        List<OrderListElement> GetOrderListElements(int userId);

        [OperationContract]
        List<Tool> GetAvailableTools(int toolTypeid);

        [OperationContract]
        void DeleteBorrow(int borrowId);
    }

    #region OrderListElement
    [DataContract]
    public class OrderListElement
    {
        private int id;
        private string brandName;
        private string typeName;
        private string availability;
        private bool borrowed;
        private bool ordered;

        [DataMember]
        public int Id 
        {
            get
            {
                return id;
            }
            set
            {
                this.id = value;
            }
        }

        [DataMember]
        public string BrandName 
        {
            get
            {
                return brandName;
            }
            set
            {
                this.brandName = value;
            }
        }

        [DataMember]
        public string TypeName 
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
            }
        }

        [DataMember]
        public string Availability
        {
            get
            {
                return availability;
            }
            set
            {
                availability = value;
            }
        }

        [DataMember]
        public bool Ordered
        {
            get
            {
                return ordered;
            }
            set
            {
                ordered = value;
            }
        }

        [DataMember]
        public bool Borrowed
        {
            get
            {
                return borrowed;
            }
            set
            {
                borrowed = value;
            }
        }
    }
    #endregion

    #region ToolType class
    [DataContract]
    public class ToolType
    {
        private int id;
        private string brandName;
        private string typeName;

        [DataMember]
        public int Id 
        {
            get
            {
                return id;
            }
            set
            {
                this.id = value;
            }
        }

        [DataMember]
        public string BrandName 
        {
            get
            {
                return brandName;
            }
            set
            {
                this.brandName = value;
            }
        }

        [DataMember]
        public string TypeName 
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
            }
        }
    }
    #endregion

    #region Tool class
    [DataContract]
    public class Tool
    {
        private int id;
        private string stockNumber;
        private int toolTypeId;
        private ToolType toolType;

        [DataMember]
        public int Id 
        {
            get
            {
                return id;
            }
            set
            {
                this.id = value;
            }
        }

        [DataMember]
        public string StockNumber 
        {
            get
            {
                return stockNumber;
            }
            set
            {
                this.stockNumber = value;
            }
        }

        [DataMember]
        public int ToolTypeId 
        {
            get
            {
                return toolTypeId;
            }
            set
            {
                this.toolTypeId = value;
            }
        }

        [DataMember]
        public ToolType ToolType
        {
            get
            {
                return toolType;
            }
            set
            {
                toolType = value;
            }
        }
    }
    #endregion

    #region Order class
    [DataContract]
    public class Order
    {
        private int id;
        private DateTime startDate;
        private int userId;
        private int toolTypeId;
        private string brandName;
        private string typeName;
        private string userName;

        [DataMember]
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }

        [DataMember]
        public DateTime StartDate
        {
            get
            {
                return startDate;
            }
            set
            {
                startDate = value;
            }
        }

        [DataMember]
        public int UserId
        {
            get
            {
                return userId;
            }
            set
            {
                userId = value;
            }
        }

        [DataMember]
        public int ToolTypeId
        {
            get
            {
                return toolTypeId;
            }
            set
            {
                toolTypeId = value;
            }
        }

        [DataMember]
        public string BrandName
        {
            get
            {
                return brandName;
            }
            set
            {
                brandName = value;
            }
        }

        [DataMember]
        public string TypeName
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
            }
        }

        [DataMember]
        public string UserName
        {
            get
            {
                return userName;
            }
            set
            {
                userName = value;
            }
        }
    }
    #endregion

    #region Borrow class
    [DataContract]
    public class Borrow
    {
        private int id;
        private int toolId;
        private int userId;
        private DateTime startDate;
        private DateTime deadline;
        private string brandName;
        private string typeName;
        private string userName;
        private string stockNumber;

        [DataMember]
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }

        [DataMember]
        public int ToolId
        {
            get
            {
                return toolId;
            }
            set
            {
                toolId = value;
            }
        }

        [DataMember]
        public int UserId
        {
            get
            {
                return userId;
            }
            set
            {
                userId = value;
            }
        }

        [DataMember]
        public DateTime StartDate
        {
            get
            {
                return startDate;
            }
            set
            {
                startDate = value;
            }
        }

        [DataMember]
        public DateTime Deadline
        {
            get
            {
                return deadline;
            }
            set
            {
                deadline = value;
            }
        }

        [DataMember]
        public string BrandName
        {
            get
            {
                return brandName;
            }
            set
            {
                brandName = value;
            }
        }

        [DataMember]
        public string TypeName
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
            }
        }

        [DataMember]
        public string UserName
        {
            get
            {
                return userName;
            }
            set
            {
                userName = value;
            }
        }

        [DataMember]
        public string StockNumber
        {
            get
            {
                return stockNumber;
            }
            set
            {
                stockNumber = value;
            }
        }
    }
    #endregion
}
